package com.smart.campus.school.handler;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class ClockHandlerFactory{

    @Autowired
    private List<ClockHandler> handlerList;

    /**
     * 根据类型获取具体的实现
     * @param clockType 类型
     * @return
     */
    public ClockHandler getClockHandler(Integer clockType){
        return handlerList.stream().filter(handler -> handler.getType() == clockType).findFirst().get();
    }


}
